<template>
	<view class="content">
		<view class="topBox">
			<view class="name">充值方式</view>
			<view class="right">
				<image class="icon" src="/pages_mine/pages/static/order/icon_wx.png" mode=""></image>
				<view class="names">微信支付</view>
			</view>
			<view class="clearBoth"></view>
		</view>
		
		<view class="title">充值金额</view>
		
		<view class="inputBox">
			<view class="icon">¥</view>
			<input class="inputTag fontSemiBold" type="number" placeholder="请输入充值金额" v-model="data.inputValue">
			<view class="clearBoth"></view>
		</view>
		
		<!-- <view class="coloOrange">该卡本次最多可充值{{data.maxMoney}}</view> -->
		
		<view class="radioBox">
			<image class="icons" src="/static/index/shopcar/icon_1.png" mode="" v-if="data.radio" @tap="tapRadio"></image>
			<view class="iconsNone" v-if="data.radio==false" @tap="tapRadio"></view>
			<view class="iconName" @tap="jumpMent">同意《支付服务协议》</view>
			<view class="clearBoth"></view>
		</view>
		
		<view class="btnGo" @tap="btnSure">确认充值</view>
		
		
	</view>
</template>
<style>
	.content{}
	.content .topBox{width: 100%;padding:3% 5%;border-bottom: 2upx solid #DDDDDD;}
	.content .topBox .name{font-size: 28upx;color:#30313B;font-weight: bold;float: left;}
	.content .topBox .right{float: right;}
	.content .topBox .right .icon{width: 42upx;height:38upx;float: left;}
	.content .topBox .right .names{font-size: 28upx;color:#666666;float: right;margin-left: 20upx;}
	.content .title{width:100%;padding:3% 5%;font-size: 28upx;color:#30313B;font-weight: bold;float: left;}
	.content .inputBox{width: 100%;padding:0 5%;border-bottom: 2upx solid #DDDDDD;}
	.content .inputBox .icon{height:110upx;line-height: 110upx;margin-right: 20upx;font-size: 40upx;color:#262626;font-weight: bold;float:left}
	.content .inputBox .inputTag{width:80%;height:110upx;line-height: 110upx;color:#262626;font-weight: bold;float:left}
	.content .coloOrange{color:#FF4E00;font-size: 20upx;padding:20upx 5%}
	.content .radioBox{width:100%;padding:10upx 5%}
	.content .radioBox .icons{width: 30upx;height:30upx;float: left;margin-right: 20upx;margin-top:5upx;}
	.content .radioBox .iconsNone{width: 30upx;height:30upx;border:2upx solid #ccc;border-radius: 30upx;float: left;margin-right: 20upx;margin-top:5upx;}
	.content .radioBox .iconName{color:#262626}
	.content .btnGo{width: 90%;margin-left: 5%;text-align: center;margin-top: 40upx;padding: 20upx 0;background: #DC582A;color:white;border-radius: 100upx;}
</style>
<script>
	import Share from '@/common/wx_share.js'
	export default {
		data() {
			return {
				share:{
					title:"",
					path:'/pages/tabbar/index',
					imageUrl:'',
					desc:'',
					content:''
				},
				data:{
					inputValue:"",
					maxMoney:200,
					radio:true
				}
				
				
				
				
				
				
				
				
			}
		},
		onLoad(){
			this.AjaxLoad()
		},
		methods: {
			AjaxLoad(){
				return;
				let param={
					client_id:1,
					api_token:this._$md5Ways("Index/index"),
					token:this._$userToken("userInfo").token,
					page:this.pages
				};
				this._$InitRequest.request("Index/index", param).then(res => {
					console.log( res , "index" );
				},error=>{})
			},
			jumpMent(){},
			tapRadio(){
				if( this.data.radio == true ){
					this.data.radio = false
				}else{
					this.data.radio = true
				}
			},
			btnSure(){
				if( this.data.radio == false ){
					uni.showToast({icon:"none",title:"请先同意支付服务协议"})
				}else if( this.data.inputValue == "" ){
					uni.showToast({icon:"none",title:"请先输入充值金额"})
				}else{
					let param={
						token:this._$userToken("userInfo").token,
						price:this.data.inputValue
					};
					this._$InitRequest.request("wallet/pay", param).then(resA => {
						uni.requestPayment({
						   provider: 'wxpay',
						   appId: resA.data.wxpayinfos.appId,
						   timeStamp: String(resA.data.wxpayinfos.timestamp),
						   nonceStr: resA.data.wxpayinfos.nonceStr,
						   package:"prepay_id="+resA.data.wxpayinfos.package,
						   signType: 'MD5',
						   paySign: resA.data.wxpayinfos.sign,
						    success: function (resB) {
								uni.showToast({icon:"success",title:"充值成功"})
								setTimeout(function(){
									uni.switchTab({
										url:"/pages/tabbar/mine"
									})
								},1500)
						    },
						    fail: function (err) {
						        console.log('fail:' + JSON.stringify(err));
						    }
						});
					},error=>{})
				}
			}
			
			
		}
	}
</script>
<style lang="scss" scoped>
// /deep/ .uni-input-input {font-size:80upx}
/deep/ .uni-radio-input-checked{background-color:rgb(110,43,34) !important;border:2upx solid white !important}
.content .html{
  ::v-deep {
    img {
      width: 100%;
    }
  }
}
</style>